<?php
/**
* AKB_PANEL Class
*
* Defines the common functions for panel classes to extend upon
*
* @name 		AKB_PANEL
* @package     ActiveKB
* @author	Jordie Bodlay <jordie@interspire.com>
* @link        http://www.interspire.com/knowledgemanager/
*
*/
class AKB_PANEL
{
	/**
	 * Stores the html filename
	 */
	var $_htmlFile;

	/**
	* ParsePanel() Function
	*
	* Loads the HTML file and parses all the constants and globals
	*
	* @name		ParsePanel()
	* @author	Jordie Bodlay <jordie@interspire.com>
	* @author	Chris Smith <chris@interspire.com>
	* @author	Mitchell Harper <mitch@interspire.com>
	* @version 	1.00
	*
	*/
	function ParsePanel()
	{

		$htmlPanelData = '';
		$parsedPanelData = '';

		// check for file and load the contents
		if (file_exists($this->_htmlFile)) {
			if ($fp = @fopen($this->_htmlFile, 'rb')) {
				while (!feof($fp)) {
					$htmlPanelData .= fgets($fp, 4096);
				}
				@fclose($fp);
			}
		}

		// set the global settings/variables for all panels
		$this->SetGlobalPanelSettings();

		// sets the local panel settings, defined within the extendee
		$this->SetPanelSettings();

		// some panels require the option to return blank
		if (isset($GLOBALS['DontDisplay']) && $GLOBALS['DontDisplay'] == true) {
			// return nothing
			$GLOBALS['DontDisplay'] = false;
			$parsedPanelData = '';
		} else {
			// parse panel as normal
			$parsedPanelData = $GLOBALS['AKB_CLASS_TEMPLATE']->ParseGL($htmlPanelData);
		}

		return $parsedPanelData;

	}

	/**
	* SetHTMLFile() Function
	*
	* Sets the Class-wide html filename variable. Only used within the extended panel class.
	*
	* @name		SetHTMLFile()
	* @author	Jordie Bodlay <jordie@interspire.com>
	* @version 	1.00
	* @param 	string $HTMLFile
	*
	*/
	function SetHTMLFile($HTMLFile)
	{
		$this->_htmlFile = $HTMLFile;
	}

	/**
	* SetGlobalPanelSettings() Function
	*
	* Sets variables and settings that can then be accessed from any panel.
	*
	* @name		SetGlobalPanelSettings()
	* @author	Jordie Bodlay <jordie@interspire.com>
	* @version 	1.00
	*
	*/
	function SetGlobalPanelSettings()
	{
		// make the site's URL global. e.g. use for image path's
		$GLOBALS['pathToKB'] = $GLOBALS['pathToKB'];
	}

}


?>